<?php
$act = $_REQUEST['act'];


include "../../../lib/DB.php";
$db = new DB();
$table = 'classification';
$data = $_REQUEST;
if($act == 'add')
{
    unset($data['act'],$data['id'],$data['change']);
    $id = $db->table($table)->insert($data);
    echo "<script >alert('添加成功..');location.href='classlfy.php'</script>";
    exit;
}
if($act == 'edit')
{
    $id = $_REQUEST['cid'];
    unset($data['act'],$data['cid'],$data['change']);
    $db = $db->table($table)->where(['cid' => $id])->update($data);
    echo "<script >alert('修改成功..');location.href='classlfy.php'</script>";
    exit;
}
if($act == 'del')
{
    $id = $_REQUEST['cid'];
    $db->table($table)->where(['cid' => $id])->delete();
    echo "<script >alert('删除成功..');location.href='classlfy.php'</script>";
    exit;
}